import type {BaseTableProps} from './type'
const TableBody:React.FC<BaseTableProps>=(props)=>{
    const {colums,data,onRowClick}= props
    return (
      <tbody className='bg-white dark:bg-slate-800'>
          {
            data && data.map((row: any, index: number) => {
              return (
                <tr key={index} onClick={()=>onRowClick!({row,index:index})}>
                {
                  colums && colums.map((col: any, colIndex: number) => {
                    return (
                      <td key={colIndex} className='border-b border-slate-100 dark:border-slate-700 p-4 pl-8 text-slate-500 dark:text-slate-400'>{row[col.field]}</td>
                    )
                  })
                }
              </tr>
              )
            })
          }
        </tbody>
    )
  }

  export default TableBody